package global;

import entity.Point;
import entity.VehicleRealtimeInfo;
import entity.VehicleTargetInfo;
import entity.enums.HikMsgType;

import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;

/**
 * 全局缓存
 *
 * @author zhouwz
 * @date 2020/11/3 13:41
 */
public class InitCache {

    static {
        registered = false;
        randomPoint = new ConcurrentHashMap<>();
        repQueue = new ConcurrentLinkedDeque<>();
        crossPointCache = new ConcurrentHashMap<>();
        vehicleTargetInfo = new VehicleTargetInfo();
    }

    /**
     * 车辆编号整数型(需要在数据库中已经注册过)
     */
    public static Integer vehicleCodeInt;

    /**
     * netty客户端器地址
     */
    public static String nettyClientIp;

    /**
     * netty客户端器端口
     */
    public static Integer nettyClientPort;

    /**
     * netty服务器地址
     */
    public static String nettyServerIp;

    /**
     * 地图数据文件路径和名称
     */
    public static String pathAndFilename = "/simulator/map_info/rcs_map_data.json";

    /**
     * 车辆目标信息
     */
    public volatile static VehicleTargetInfo vehicleTargetInfo;

    /**
     * 回复队列
     */
    public volatile static Queue<HikMsgType> repQueue;

    /**
     * 是否注册
     */
    public volatile static Boolean registered;

    /**
     * 穿过点位缓存
     */
    public static Map<String, Point> crossPointCache;

    /**
     * 通过随机下标获取对应点位
     */
    public static Map<Integer, String> randomPoint;

    /**
     * 车辆实时状态
     */
    public volatile static VehicleRealtimeInfo realtimeStatus;
}
